import { observable, action, toJS } from 'mobx';
import { WeaTableNew, WeaForm } from 'comsMobx';
import { ComsStore } from './tables/common';
import * as API_MORE from '../apis/more';
import { Modal } from 'antd';

const confirm = Modal.confirm;
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;

export class DocMoreStore extends ComsStore {
  @observable title = '';// getLabel(19874,'知识中心'); //19874-文档中心，18441-未读文档
  @observable showSearchAd = false;
  @observable elementmore = {};
  @observable treeData = [];
  @observable quickSearchValue = '';
  @observable isNew = '0';
  @observable showDocLog = false;
  @observable logDocId = '';
  @observable showDocShare = false;
  @observable shareDocId = '';

  // @action
  setState = (params = {}) => {
    Object.keys(params).forEach((key) => {
      this[key] = params[key];
    });
    return this;
  }
  getElementmore = params => API_MORE.getElementmore(params).then((result) => {
      let elementmore = result ? result.elementmore : {};
      this.setElementmore(elementmore);
    })
  setTitle = (title) => {
    this.title = title;
  }
  setElementmore = (key) => {
    this.elementmore = key;
  }
  setIsNew = (key) => {
    this.isNew = key;
  }
  setShowSearchAd = (showSearchAd) => {
    this.showSearchAd = showSearchAd;
  }
  setQuickSearchValue = (quickSearchValue) => {
    this.quickSearchValue = quickSearchValue;
  }
}

